package com.homegoods.classify.ui.fragment;

import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.util.Log;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.alibaba.fastjson.JSON;
import com.homegoods.aroutercomment.ARouterPath;
import com.homegoods.classify.R;
import com.homegoods.classify.adapter.ZPOtherAdapter;
import com.homegoods.classify.databinding.ClassifyFragmentOtherBinding;
import com.homegoods.classify.model.ClassifyModel;
import com.homegoods.classify.persenter.ZPOtherPresenter;
import com.kedll.library.fragment.KBaseFragment;

/**
 * add shibo.zheng
 * 19/06/20
 * 其他分类 fragment
 */
@Route(path = ARouterPath.PATH_ZP_CLASSIFY_OTHER)
public class ZPClassifyOtherFragment extends KBaseFragment<ClassifyFragmentOtherBinding, ZPOtherPresenter> {
    @Autowired(name = "classifyModel")
    public ClassifyModel classifyModel;

    @Override
    protected void initEvent(Bundle savedInstanceState) {
        ARouter.getInstance().inject(this);
        Log.d(TAG, "initEvent: classifyModel ZPClassifyOtherFragment == " + JSON.toJSONString(classifyModel));
        mBinding.otherRightList.setLayoutManager(new GridLayoutManager(getContext(), 3));
        ZPOtherAdapter adapter = new ZPOtherAdapter(getContext(), classifyModel.getRightModels());
        mBinding.otherRightList.setAdapter(adapter);
    }

    @Override
    protected ZPOtherPresenter getPresenter() {
        return new ZPOtherPresenter(this);
    }

    @Override
    protected int getLayout() {
        return R.layout.classify_fragment_other;
    }
}
